package com.chenfan.common.exception;

import lombok.Getter;
import org.apache.commons.lang.StringUtils;

/**
 * 业务结果待处理异常 待前端进步处理
 * @author wulg
 * @date 2024/3/12
 */
@Getter
public class ResultPendingException extends BusinessException {

    private Object data;

    public ResultPendingException(Object data) {
        this(SystemState.RESULT_PENDING, data);
    }


    public ResultPendingException(ResultState resultState, Object data) {
        super(resultState.code(), resultState.message());
        this.data = data;
    }

    public ResultPendingException(String message, Object data) {
        super(SystemState.RESULT_PENDING.code(), StringUtils.defaultIfBlank(message, SystemState.RESULT_PENDING.message()));
        this.data = data;
    }

    public ResultPendingException(int code, String message, Object data) {
        super(code, message);
        this.data = data;
    }
}
